home *** CD-ROM | disk | FTP | other *** search
/ Sprite 1984 - 1993 / Sprite 1984 - 1993.iso / lib / tclX-6.4 / help / files / file < prev    next >
Encoding:
Text File  |  1992-12-17  |  6.0 KB  |  125 lines

  1.           file option name ?arg arg ...?
  2.                Operate on a file or a file name.  Name is the name  of
  3.                a   file;  if  it  starts  with  a  tilde,  then  tilde
  4.                substitution is done before executing the command  (see
  5.                the  manual  entry  for  Tcl_TildeSubst  for  details).
  6.                Option indicates what to do with the  file  name.   Any
  7.                unique  abbreviation  for  option  is  acceptable.  The
  8.                valid options are:
  9.  
  10.                file atime name
  11.                     Return  a  decimal string giving the time at which
  12.                     file name was last accessed.  The time is measured
  13.                     in  the  standard  UNIX  fashion as seconds from a
  14.                     fixed starting time (often January 1,  1970).   If
  15.                     the  file  doesn't exist or its access time cannot
  16.                     be queried then an error is generated.
  17.  
  18.                file dirname name
  19.                     Return all of the characters in name up to but not
  20.                     including the last slash character.  If there  are
  21.                     no slashes in name then return ``.''.  If the last
  22.                     slash in name is its first character, then  return
  23.                     ``/''.
  24.  
  25.                file executable name
  26.                     Return 1 if file name is executable by the current
  27.                     user, 0 otherwise.
  28.  
  29.                file exists name
  30.                     Return  1 if file name exists and the current user
  31.                     has search privileges for the directories  leading
  32.                     to it, 0 otherwise.
  33.  
  34.                file extension name
  35.                     Return  all  of  the  characters in name after and
  36.                     including the last dot in name.  If  there  is  no
  37.                     dot in name then return the empty string.
  38.  
  39.                file isdirectory name
  40.                     Return 1 if file name is a directory, 0 otherwise.
  41.  
  42.                file isfile name
  43.                     Return  1  if  file  name  is  a  regular  file, 0
  44.                     otherwise.
  45.  
  46.                file lstat name varName
  47.                     Same  as  stat  option (see below) except uses the
  48.                     lstat kernel call instead  of  stat.   This  means
  49.                     that  if  name  refers  to  a  symbolic  link  the
  50.                     information returned in varName is  for  the  link
  51.                     rather  than  the  file  it refers to.  On systems
  52.                     that don't  support  symbolic  links  this  option
  53.                     behaves exactly the same as the stat option.
  54.  
  55.                file mtime name
  56.                     Return  a  decimal string giving the time at which
  57.                     file name was last modified.  The time is measured
  58.                     in  the  standard  UNIX  fashion as seconds from a
  59.                     fixed starting time (often January 1,  1970).   If
  60.                     the file doesn't exist or its modified time cannot
  61.                     be queried then an error is generated.
  62.  
  63.                file owned name
  64.                     Return  1  if  file  name  is owned by the current
  65.                     user, 0 otherwise.
  66.  
  67.                file readable name
  68.                     Return  1  if file name is readable by the current
  69.                     user, 0 otherwise.
  70.  
  71.                file readlink name
  72.                     Returns  the  value  of the symbolic link given by
  73.                     name (i.e. the name of the file it points to).  If
  74.                     name  isn't a symbolic link or its value cannot be
  75.                     read, then an error is returned.  On systems  that
  76.                     don't   support  symbolic  links  this  option  is
  77.                     undefined.
  78.  
  79.                file rootname name
  80.                     Return all of the characters in name up to but not
  81.                     including the last ``.'' character  in  the  name.
  82.                     If name doesn't contain a dot, then return name.
  83.  
  84.                file size name
  85.                     Return  a  decimal  string giving the size of file
  86.                     name in bytes.  If the file doesn't exist  or  its
  87.                     size cannot be queried then an error is generated.
  88.  
  89.                file stat  name varName
  90.                     Invoke  the  stat kernel call on name, and use the
  91.                     variable given  by  varName  to  hold  information
  92.                     returned from the kernel call.  VarName is treated
  93.                     as an array variable, and the  following  elements
  94.                     of  that variable are set: atime, ctime, dev, gid,
  95.                     ino, mode, mtime, nlink, size,  type,  uid.   Each
  96.                     element  except  type is a decimal string with the
  97.                     value of the corresponding  field  from  the  stat
  98.                     return  structure;  see  the manual entry for stat
  99.                     for details on the meanings of  the  values.   The
  100.                     type  element  gives  the  type of the file in the
  101.                     same form returned by the command file type.  This
  102.                     command returns an empty string.
  103.  
  104.                file tail name
  105.                     Return  all  of  the  characters in name after the
  106.                     last slash.  If  name  contains  no  slashes  then
  107.                     return name.
  108.  
  109.                file type name
  110.                     Returns  a  string  giving  the type of file name,
  111.                     which   will   be   one   of   file,    directory,
  112.                     characterSpecial,  blockSpecial,  fifo,  link,  or
  113.                     socket.
  114.  
  115.                file writable name
  116.                     Return  1  if file name is writable by the current
  117.                     user, 0 otherwise.
  118.  
  119.                The  file  commands  that  return 0/1 results are often
  120.                used in conditional or looping commands, for example:
  121.  
  122.                     if {![file exists foo]} then {error {bad file name}}
  123.  
  124.  
  125.